<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件

/**
 * 递归的合并数组
 * 与`array_merge_recursive`不同，只会递归合并数组，其他类型数据会被覆盖
 * @param array $array1
 * @param array $array2
 * @return array
 */
function array_recursive_merge($array1,$array2)
{
    foreach($array2 as $key => $value){
        if(isset($array1[$key]) && is_array($array1[$key]) && is_array($value)){
            $array1[$key]=array_recursive_merge($array1[$key], $value);
        }
        else{
            $array1[$key]=$value;
        }
    }
    return $array1;
}
